package com.hdoit.ares.quartz;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import com.hdoit.ares.logical.acc.service.IGoldenBeanDetailService;
import com.hdoit.ares.logical.acc.service.IIncomeDetailService;
import com.tennetcn.common.annotation.QuartzTaskConfig;
import com.tennetcn.common.aop.CommonApplicationContextUtil;
import com.tennetcn.common.utils.DateUtils;

@QuartzTaskConfig(cronTrigger = "0 0 6,8,12,15,18,20,22 * * ?", jobTitle = "将度过犹豫期的金豆或者金额设置为可提现")
public class QuartzConfirmWithdrawJob implements Job{
	/*"0 0 6,8,12,15,18,20,22 * * ?"*/
	
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		
		//1.将度过犹豫期的金豆更改为非犹豫期状态
		IGoldenBeanDetailService goldenBeanDetailService = CommonApplicationContextUtil.getCurrentContext().getBean(IGoldenBeanDetailService.class);
		if(goldenBeanDetailService.updateHesitatePeriodState(DateUtils.getCurrent())){
			System.err.println("犹豫期已过\t" + DateUtils.getCurrent());
		}
		//2.将度过犹豫期的奖金更改为非犹豫期状态
		IIncomeDetailService incomeDetailService = CommonApplicationContextUtil.getCurrentContext().getBean(IIncomeDetailService.class);
		if(incomeDetailService.updateHesitatePeriodState(DateUtils.getCurrent())){
			System.err.println("犹豫期已过\t" + DateUtils.getCurrent());
		}
	}
	
	

}
